package com.wfcm.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.wfcm.annotation.IgnoreToken;
import com.wfcm.entity.WfChapterPlayRecordEntity;
import com.wfcm.entity.WfCourseChapterEntity;
import com.wfcm.entity.WfCourseCommentEntity;
import com.wfcm.entity.WfCourseInfoEntity;
import com.wfcm.entity.WfVipCardEntity;
import com.wfcm.service.WfChapterPlayRecordService;
import com.wfcm.service.WfCourseChapterService;
import com.wfcm.service.WfCourseCommentService;
import com.wfcm.service.WfCourseInfoService;
import com.wfcm.service.WfVipCardService;
import com.wfcm.utils.PageUtils;
import com.wfcm.utils.Query;
import com.wfcm.utils.R;
import com.wfcm.utils.WebUtils;


/**
 * 
 * @content 王芳精品Controller
 */
@RequestMapping("/wangfang")
@Controller
public class WangFangController {
	private Logger log = LoggerFactory.getLogger(AdInfoController.class);
	@Autowired
	WfCourseChapterService courseChapterService;
	@Autowired
	WfCourseInfoService courseInfoService;
	@Autowired
	private WfVipCardService vipCardService;
	@Autowired
	private WfCourseCommentService courseCommentService;
	@Autowired
	private WfChapterPlayRecordService chapterPlayRecordService;
	
	/**
	 * 王芳精品分类列表
	 */
	@RequestMapping("/courseInfoList")
	@ResponseBody
	@IgnoreToken
	public R courseInfoList(HttpServletRequest req) {
		
		String courseCategoryId = req.getParameter("courseCategoryId");
		String ageId = req.getParameter("ageId");
		String speaker = req.getParameter("speaker");
		log.debug("courseCategoryId:"+courseCategoryId);
		log.debug("ageId:"+ageId);
		log.debug("speaker:"+speaker);
		
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("courseCategoryId",courseCategoryId);
		map.put("ageId", ageId);
		map.put("speaker",speaker);
		List<WfCourseInfoEntity> courseInfoList = courseInfoService.queryCategoryList(map);
		//查询相关课程包
		List<WfVipCardEntity> vipCardlist =  new ArrayList<WfVipCardEntity>();
		vipCardlist = vipCardService.queryCategoryList(map);
		
		Map<String,Object> resultMap = new HashMap<String,Object>();
		resultMap.put("courseInfoList", courseInfoList);
		resultMap.put("vipCardlist", vipCardlist);
		
		return R.ok(resultMap);
	}

}
